package com.cy.web;

import com.alibaba.fastjson.JSONArray;
import com.cy.bean.Driverschool;
import com.cy.bean.Student;
import com.cy.service.GetCoachInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class GetCoachController {
    @Autowired
    private GetCoachInfoService getCoachInfoService;

    @RequestMapping("/getCoachInfo")
    public @ResponseBody
    String getCoachInfo(){
        List<Driverschool> list = getCoachInfoService.getCoachInfo();
        String obj = JSONArray.toJSONString(list);

        return obj;
    }

    @RequestMapping("/addDriverSchool")
    public @ResponseBody
    String addDriverSchool(Driverschool driverschool){
        if (getCoachInfoService.addDriverSchool(driverschool)>0){
            return "1";
        }
        return null;
    }
}
